import Vue from 'vue';
import Vuex from 'vuex';
// vuex 持久化组件
import createPersistedState from 'vuex-persistedstate';

import user from './modules/user';
import addDevice from './modules/addDevice';

Vue.use(Vuex);
export default new Vuex.Store({
	modules: { user, addDevice },
	plugins: [createPersistedState({
		storage: { // 存储方式定义
			getItem: (key) => uni.getStorageSync(key), // 获取
			setItem: (key, value) => uni.setStorageSync(key, value), // 存储
			removeItem: (key) => uni.removeStorageSync(key) // 删除
		}
	})]
});
